import 'package:custom_widgets/item/item_normal_widget.dart';
import 'package:custom_widgets/tool/bot_toast_util.dart';
import 'package:flutter/material.dart';

class BotToastDemoPage extends StatefulWidget {
  @override
  _BotToastDemoPageState createState() => _BotToastDemoPageState();
}

class _BotToastDemoPageState extends State<BotToastDemoPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("测试BotToast"),
        centerTitle: true,
        elevation: 0.0,
      ),
      body: _buildBody(),
    );
  }

  _buildBody() {
    return ListView(
      children: ItemNormalWidget.divideTiles(
        childs: <Widget>[
          ItemNormalWidget.item(
            title: "BotToast(showText))",
            onTap: () {
              BotToastUtil.showText(text: "BotToast");
            },
          ),
          ItemNormalWidget.item(
            title: "BotToast(showSuccess))",
            onTap: () {
              BotToastUtil.showSuccess("showSuccess");
            },
          ),
          ItemNormalWidget.item(
            title: "BotToast(showError))",
            onTap: () {
              BotToastUtil.showError("showError");
            },
          ),
          ItemNormalWidget.item(
            title: "BotToast(showWarning))",
            onTap: () {
              BotToastUtil.showWarn("showWarning");
            },
          ),
          ItemNormalWidget.item(
            title: "BotToast(showLoading))",
            onTap: () {
              BotToastUtil.showLoading();
            },
          ),
        ],
      ).toList(),
    );
  }
}
